package com.itheima.demo;

import com.itheima.domain.User;
import com.itheima.mapper.UserMapper;
import com.itheima.service.UserService;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.InputStream;
import java.util.List;

public class TestUser {
    public static void main(String[] args)throws Exception {
        ApplicationContext ac=new ClassPathXmlApplicationContext("spring.xml");
//        //4、获取代理对象
//        UserMapper mapper = ac.getBean(UserMapper.class);
//        //5、执行代理对象方法
//        List<User> all = mapper.findAll();
//        System.out.println(all);
        UserService userService = ac.getBean(UserService.class);
        List<User> all = userService.findAll();
        System.out.println(all);
    }
}
